<template>
    <div id="app">
        <div class="container">
                <transition :name="transitionName" mode="out-in">
            <keep-alive>
                    <router-view name="default" />
            </keep-alive>
                </transition>
        </div>
        <router-view name="pageFooter" />
    </div>
</template>

<script>

export default {
    name: 'App',
    data () {
        return {
            transitionName: ''
        }
    },
    watch: {
        $route (to, from) {
            if (to.meta.index !== undefined && from.meta.index !== undefined) {
                if (to.meta.index > from.meta.index) {
                    this.transitionName = 'slide-right'
                } else if (to.meta.index < from.meta.index) {
                    this.transitionName = 'slide-left'
                } else {
                    this.transitionName = ''
                }
            }
        }
    }
}
</script>

<style lang="scss">
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul, li {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
html, body {
    width: 100%;
    height: 100%;
    font-family: 'PingFangSC-Light', 'PingFang SC', 'STHeitiSC-Light', 'Helvetica-Light', 'Arial', 'sans-serif';
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    .container {
        flex: 1;
        overflow-x: hidden;
    }

.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active{
    transition: all 100ms
}
.slide-right-enter {
    transform: translate3d(100%,0,0);
}
.slide-right-enter-to {
    transform: translate3d(0,0,0);
}
.slide-right-leave {
    transform: translate3d(0,0,0);
}
.slide-right-leave-to {
    transform: translate3d(-100%,0,0);
}
.slide-left-enter {
    transform: translate3d(-100%,0,0);
}
.slide-left-enter-to {
    transform: translate3d(0,0,0);
}
.slide-left-leave {
    transform: translate3d(0,0,0);
}
.slide-left-leave-to {
    transform: translate3d(100%,0,0);
}
}
</style>
